import { axiosGet , axiosPost } from '@/commonAPI/index.js'

//首页信息接口
function getIndexInfo(){
	const url = '/goods/getIndexInfo'
	return new Promise(function(resolve,reject){
		resolve(axiosGet(url))
	}).catch(function(err){
		reject(err)
	})
}

// 商品详情页接口
function getDetailGoodsInfo(config){
	const url = '/goods/getDetailGoodsInfo'
	return new Promise(function(resolve,reject){
		resolve(axiosPost(url,config))
	}).catch(function(err){
		reject(err)
	})
}

//读取大类数据的接口
function getCategoryList(){
	const url = '/goods/getCategoryList'
	return new Promise(function(resolve,reject){
		resolve(axiosGet(url))
	}).catch(function(err){
		reject(err)
	})
}

//读取小类的数据
function getCategorySubList(config){
	const url = '/goods/getCategorySubList'
	return new Promise(function(resolve,reject){
		resolve(axiosPost(url,config))
	}).catch(function(err){
		reject(err)
	})
}

//根据类别获取商品列表
function getGoodsListByCategorySubID(config){
	const url = '/goods/getGoodsListByCategorySubID'
	return new Promise(function(resolve,reject){
		resolve(axiosPost(url,config))
	}).catch(function(err){
		reject(err)
	})
}

export {
	getIndexInfo,
	getDetailGoodsInfo,
	getCategoryList,
	getCategorySubList,
	getGoodsListByCategorySubID
}